﻿<%@ Page Title="" Language="C#" MasterPageFile="~/AdminPanel/AdminSite.Master" AutoEventWireup="true" CodeBehind="Operators.aspx.cs" Inherits="FastTrackCabService.AdminPanel.Operators" %>
<%@ Import Namespace="BusinessLogicLayer" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <link href="../Style/Supervisors.css" rel="stylesheet" type="text/css"/>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <table style="margin: 1.5em auto;">
                <tr>
                    <td>
                        <div class="searchBox">
                            <asp:TextBox ID="tbSearch" runat="server" min="1" placeholder="Search by staff id" CssClass="myTextBox"
                                         TextMode="Number">
                            </asp:TextBox>
                            <asp:ImageButton ID="ibtnSearch" runat="server" OnClick="ibtnSearch_OnClick" ImageUrl="~/Images/magnifying_glass_icon.png">
                            </asp:ImageButton>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:GridView ID="gvAdmins" CssClass="supervisors" runat="server" CellPadding="4"
                                      ForeColor="#333333" GridLines="None" AllowPaging="True" AutoGenerateColumns="False"
                                      OnPageIndexChanging="gvAdmins_OnPageIndexChanging">
                            <AlternatingRowStyle BackColor="White" ForeColor="#284775"/>
                            <Columns>
                                <asp:BoundField DataField="StaffId" HeaderText="Id"/>
                                <asp:BoundField DataField="Username" HeaderText="Username"/>
                                <asp:BoundField DataField="FirstName" HeaderText="First Name"/>
                                <asp:BoundField DataField="TelephoneNo" HeaderText="Telephone"/>
                                <asp:TemplateField HeaderText="Action">
                                    <ItemTemplate>
                                        <asp:ImageButton ID="ibView" ToolTip="View full details" Width="30" PostBackUrl='<%# "OperatorFullView.aspx?staffId=" + Eval("StaffId") %>'
                                                         ImageUrl="../Images/view-black.png" runat="server">
                                        </asp:ImageButton>
                                        <asp:ImageButton ID="ibBan" Visible='<%# UserBLL.GetUserByUsername(Eval("Username").ToString()).Status %>' PostBackUrl='<%# "?username=" + Eval("Username") %>' OnClick="ibBan_OnClick" ToolTip="Ban this operator" OnClientClick=" if (!confirm('Are you sure do you want to ban this this operator?')) return false; " ImageUrl="../Images/lock.png" runat="server"/>
                                        <asp:ImageButton ID="ibUnban" Visible='<%# !UserBLL.GetUserByUsername(Eval("Username").ToString()).Status %>' ToolTip="Unban this operator" PostBackUrl='<%# "?username=" + Eval("Username") %>' OnClick="ibUnban_OnClick" ImageUrl="../Images/unlock.png" runat="server"/>
                                        <asp:ImageButton ID="ibDelete" OnClientClick=" if (!confirm('Are you sure do you want to remove this operator?\nAll records related to this operator also will be delete!\nThis cannot be undone!')) return false; "
                                                         ToolTip="Remove this supervisor" OnClick="ibDelete_OnClick" PostBackUrl='<%# "?StaffId=" + Eval("StaffId") %>'
                                                         ImageUrl="../Images/delete-black.png" runat="server"/>
                                    </ItemTemplate>
                                </asp:TemplateField>
                            </Columns>
                            <EmptyDataRowStyle CssClass="emptyDataRow"></EmptyDataRowStyle>
                            <EmptyDataTemplate>
                                <table class="supervisors" id="ContentPlaceHolder1_gvSupervisors"
                                       style="border-collapse: collapse; color: #333333; width: 400px;">
                                    <tr style="background-color: #5D7B9D; color: White; font-weight: bold;">
                                        <th scope="col">
                                            Id
                                        </th>
                                        <th scope="col">
                                            First Name
                                        </th>
                                        <th scope="col">
                                            Telephone
                                        </th>
                                        <th scope="col">
                                            Action
                                        </th>
                                    </tr>
                                    <tr style="background-color: #F7F6F3; color: #333333;">
                                        <td colspan="4" style="padding: 0.5em;">
                                            NO OPERATORS AVAILABLE
                                        </td>
                                    </tr>
                                </table>
                            </EmptyDataTemplate>
                            <EditRowStyle BackColor="#999999"/>
                            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White"/>
                            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White"/>
                            <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center"/>
                            <RowStyle BackColor="#F7F6F3" ForeColor="#333333"/>
                            <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333"/>
                            <SortedAscendingCellStyle BackColor="#E9E7E2"/>
                            <SortedAscendingHeaderStyle BackColor="#506C8C"/>
                            <SortedDescendingCellStyle BackColor="#FFFDF8"/>
                            <SortedDescendingHeaderStyle BackColor="#6F8DAE"/>
                        </asp:GridView>
                    </td>
                </tr>
            </table>
        </ContentTemplate>
    </asp:UpdatePanel>
    <asp:ImageButton ID="ibAdd" ToolTip="Add a supervisor" ImageUrl="../Images/add-yellow.png"
                     PostBackUrl="OperatorRegistrationForm.aspx" CssClass="addButton" runat="server"/>
</asp:Content>